package com.zhongying.jf.util;

import java.util.Calendar;
import java.util.UUID;

public class UUIDUtil {

	public static void  main(String[] args){
		System.out.println(getUUID32().length());
	}

	public static String getUUID() {
		String uuidString = UUID.randomUUID().toString();
		uuidString = uuidString.substring(0, 8);
		return uuidString;
	}

	public static String getUUID32() {
		String uuidString = UUID.randomUUID().toString();
		uuidString = uuidString.replaceAll("-", "");
		return uuidString;
	}

	public static String getQrCodeCode() {
		Calendar cal = Calendar.getInstance();
		int month = cal.get(Calendar.MONTH )+1;
		int day = cal.get(Calendar.DATE);
		String monthStr="";
		String dayStr="";
		if(month<10){
			 monthStr = "0"+month;
		}
		if(day<10){
			dayStr = "0"+day;
		}
		String uuidString = monthStr+dayStr+getUUID();
		return uuidString.toUpperCase();
	}
}
